package com.liwuij.springbootredis.service;

import com.alibaba.fastjson2.JSON;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * @author liwuji
 * @date 2024/2/23
 * @desc
 **/
@Service
public class DemoService {
    @Resource
    private RedisTemplate redisTemplate;
    public void demno(){
        ValueOperations valueOperations = redisTemplate.opsForValue();
        valueOperations.set("demo", JSON.toJSONString(LocalDateTime.now()));
    }
    
}
